package core

import (
	"fmt"
	"mcp-demo/internal/config/initialize"
	"mcp-demo/internal/global"
	"time"
)

func RunServer() {
	// 初始化路由
	Router := initialize.Routers()
	address := fmt.Sprintf(":%d", global.CONFIG.System.Addr)
	serverInfo := fmt.Sprintf(`
	欢迎使用 %s
	当前版本: v1.0.0
	当前环境: %s
	默认自动化文档地址: http://127.0.0.1%s%s/swagger/index.html
	默认MCP SSE地址: http://127.0.0.1%s%s%s
	默认MCP Message地址: http://127.0.0.1%s%s%s
`, global.CONFIG.System.Name, global.ENV, address, global.CONFIG.System.RouterPrefix, address, global.CONFIG.System.RouterPrefix, global.CONFIG.MCP.SSEPath, address, global.CONFIG.System.RouterPrefix, global.CONFIG.MCP.MessagePath)
	global.L.Info(serverInfo)
	initServer(address, Router, 10*time.Minute, 10*time.Minute)
}
